﻿using System;
using System.Collections.Generic;
using System.Text;
using log4net;

namespace Possan.IOC
{
	public class ObjectFactory
	{
		private static ILog logger = LogManager.GetLogger(typeof(ObjectFactory));

		public static void AddActivatorAttribute(Type activatorattribute)
		{
			Factory.Registry.AddActivatorAttribute(activatorattribute);
		}

		public static object Create(Type interfacetype)
		{
			return Factory.Registry.Create(interfacetype);
		}

		public static T Create<T>()
		{
			return (T)Factory.Registry.Create<T>();
		}

		public static T Create<T>(Type t)
		{
			return (T)Factory.Registry.Create<T>(t);
		}

		public static List<object> GetAll(Type t)
		{
			return Factory.Registry.GetAll(t);
		}

		public static List<T> GetAll<T>()
		{
			return Factory.Registry.GetAll<T>();
		}

		public static List<Type> GetAllTypes<T>()
		{
			return Factory.Registry.GetAllTypes<T>();
		}

		public static List<Type> GetAllTypes(Type t)
		{
			return Factory.Registry.GetAllTypes(t);
		}

		public static void Inject(object target)
		{
			Factory.Registry.Inject(target);
		}
	}
}
